package cn.com.interstore.bg.dom.org;

import java.util.List;

import org.nakedobjects.applib.AbstractFactoryAndRepository;
import org.nakedobjects.applib.Filter;
import org.nakedobjects.applib.annotation.Exploration;
import org.nakedobjects.applib.annotation.MemberOrder;

public class PaymentMethodRepository extends AbstractFactoryAndRepository {
	// {{ Create new (still transient) PaymentMethod
	public PaymentMethod newPaymentMethod() {
		PaymentMethod paymentMethod = newTransientInstance(PaymentMethod.class);
		// TODO: set up any properties
		paymentMethod.setStatus(PaymentMethodStatus.INITIAL);

		return paymentMethod;
	}

	// }}

	// {{ all PaymentMethod
	@Exploration
	public List<PaymentMethod> allPaymentMethod() {
		return allInstances(PaymentMethod.class);
	}

	// }}

	// {{ findByName
	@MemberOrder(sequence = "1")
	public List<PaymentMethod> findByName(final String name) {
		return this.allMatches(PaymentMethod.class,
				new Filter<PaymentMethod>() {
					public boolean accept(final PaymentMethod paymentMethod) {
						return paymentMethod.getName().equals(name);
					}
				});

	}
	// }}

}
